/////////////////////////////////////////////////////////////////////////////
// Name:        preferencesdialog.cpp
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     19/02/2009 09:00:59
// RCS-ID:      
// Copyright:   
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#include "wx/wx.h"

////@begin includes
#include "wx/bookctrl.h"
////@end includes

#include "blurtapp.h"

#include "preferencesdialog.h"

////@begin XPM images
////@end XPM images


/*
 * BlurtPreferencesDialog type definition
 */

IMPLEMENT_DYNAMIC_CLASS( BlurtPreferencesDialog, wxPropertySheetDialog )


/*
 * BlurtPreferencesDialog event table definition
 */

BEGIN_EVENT_TABLE( BlurtPreferencesDialog, wxPropertySheetDialog )

////@begin BlurtPreferencesDialog event table entries
////@end BlurtPreferencesDialog event table entries

END_EVENT_TABLE()


/*
 * BlurtPreferencesDialog constructors
 */

BlurtPreferencesDialog::BlurtPreferencesDialog()
{
    Init();
}

BlurtPreferencesDialog::BlurtPreferencesDialog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
    Init();
    Create(parent, id, caption, pos, size, style);
}


/*
 * BlurtPreferencesDialog creator
 */

bool BlurtPreferencesDialog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin BlurtPreferencesDialog creation
    SetExtraStyle(wxWS_EX_VALIDATE_RECURSIVELY|wxWS_EX_BLOCK_EVENTS);
    SetSheetStyle(wxPROPSHEET_DEFAULT);
    wxPropertySheetDialog::Create( parent, id, caption, pos, size, style );

    CreateButtons(wxOK|wxCANCEL);
    CreateControls();
    LayoutDialog();
    Centre();
////@end BlurtPreferencesDialog creation
    return true;
}


/*
 * BlurtPreferencesDialog destructor
 */

BlurtPreferencesDialog::~BlurtPreferencesDialog()
{
////@begin BlurtPreferencesDialog destruction
////@end BlurtPreferencesDialog destruction
}


/*
 * Member initialisation
 */

void BlurtPreferencesDialog::Init()
{
////@begin BlurtPreferencesDialog member initialisation
    m_speechSettingsPanel = NULL;
    m_mp3SettingsPanel = NULL;
////@end BlurtPreferencesDialog member initialisation
}


/*
 * Control creation for BlurtPreferencesDialog
 */

void BlurtPreferencesDialog::CreateControls()
{    
////@begin BlurtPreferencesDialog content construction
    BlurtPreferencesDialog* itemPropertySheetDialog1 = this;

    m_speechSettingsPanel = new wxTTSSpeechSettingsPanel( GetBookCtrl(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );

    GetBookCtrl()->AddPage(m_speechSettingsPanel, _("Speech"));

    m_mp3SettingsPanel = new wxTTSMP3SettingsPanel( GetBookCtrl(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );

    GetBookCtrl()->AddPage(m_mp3SettingsPanel, _("MP3"));

////@end BlurtPreferencesDialog content construction

    wxUnusedVar(itemPropertySheetDialog1);

    m_speechSettingsPanel->SetInfo(wxGetApp().GetSpeechSettingsInfo());
    m_mp3SettingsPanel->SetInfo(wxGetApp().GetMP3SettingsInfo());
}

/*
 * Should we show tooltips?
 */

bool BlurtPreferencesDialog::ShowToolTips()
{
    return true;
}

/*
 * Get bitmap resources
 */

wxBitmap BlurtPreferencesDialog::GetBitmapResource( const wxString& name )
{
    // Bitmap retrieval
////@begin BlurtPreferencesDialog bitmap retrieval
    wxUnusedVar(name);
    return wxNullBitmap;
////@end BlurtPreferencesDialog bitmap retrieval
}

/*
 * Get icon resources
 */

wxIcon BlurtPreferencesDialog::GetIconResource( const wxString& name )
{
    // Icon retrieval
////@begin BlurtPreferencesDialog icon retrieval
    wxUnusedVar(name);
    return wxNullIcon;
////@end BlurtPreferencesDialog icon retrieval
}

/// Data transfer
bool BlurtPreferencesDialog::TransferDataFromWindow()
{
    wxPropertySheetDialog::TransferDataFromWindow();

    wxGetApp().GetSpeechSettingsInfo() = m_speechSettingsPanel->GetInfo();
    wxGetApp().GetMP3SettingsInfo() = m_mp3SettingsPanel->GetInfo();

    return true;
}
